#include <stdio.h>
#include "setting.h"
#include "virtual_flash.h"
#include <string.h>
#include "comfun.h"
#include "auto_report.h"
#include "smart_sensor.h"


void sys_init()
{
    flash_init();
}

void report_init()
{
    uint16_t freq_min = 60;
    uint16_t step_min_arry[4] = {100,100,5,3};
	uint16_t on_power_delay_time = get_le_val(setting.dev_infor.power_on_delay_time,2);

    smart_sensor_init();
    auto_report_init(freq_min,step_min_arry,on_power_delay_time,SENSOR_NUMS);
}

int main()
{
	int result;
    sys_init();
    setting_load();
    dev_show();
    report_init();

    while(1)
    {
    	result = auto_report_hook_1s(sensor_device,SENSOR_NUMS);
    	if(result<0)
    		break;
    }

    log_d("auto report done ,1 hour !!\n");
    return 0;
}
